package model

var RepositoryNames = struct { // repositories
	User                       string
	Transaction                string
	UserAddress                string
	UserTaskLog                string
	UserTransactionLog         string
	UserIntegralTransactionLog string
	UserAttachmentRelationship string
}{
	User:                       "User",
	Transaction:                "Transaction",
	UserAddress:                "UserAddress",
	UserTaskLog:                "UserTaskLog",
	UserTransactionLog:         "UserTransactionLog",
	UserIntegralTransactionLog: "UserIntegralTransactionLog",
	UserAttachmentRelationship: "UserAttachmentRelationship",
}

var RepositoryPreloadMap = map[string]map[string]string{
	RepositoryNames.User: {
		"Id":        UserColumns.ID,
		"Account":   UserColumns.UserLogin,
		"Email":     UserColumns.UserEmail,
		"Mobile":    UserColumns.UserMobile,
		"Status":    UserColumns.UserStatus,
		"CreatedAt": UserColumns.CreatedAt,
		"UpdatedAt": UserColumns.UpdatedAt,
	},
	RepositoryNames.Transaction: {
		"Id":           UserTransactionLogColumns.UserTransactionLogID,
		"UserId":       UserTransactionLogColumns.UserID,
		"UserName":     UserTransactionLogColumns.UserName,
		"AssetType":    UserTransactionLogColumns.AssetType,
		"ChangeType":   UserTransactionLogColumns.ChangeType,
		"ChangeAmount": UserTransactionLogColumns.ChangeAmount,
		"SourceType":   UserTransactionLogColumns.SourceType,
		"SourceId":     UserTransactionLogColumns.SourceID,
		"SourceDesc":   UserTransactionLogColumns.Desc,
		"Status":       UserTransactionLogColumns.Status,
		"CreatedAt":    UserTransactionLogColumns.CreatedAt,
		"UpdatedAt":    UserTransactionLogColumns.UpdatedAt,
	},
	RepositoryNames.UserAddress: {
		"Id":              UserAddressColumns.UserAddressID,
		"UserId":          UserAddressColumns.UserID,
		"Label":           UserAddressColumns.Label,
		"Consignee":       UserAddressColumns.Consignee,
		"Mobile":          UserAddressColumns.Mobile,
		"Province":        UserAddressColumns.Province,
		"City":            UserAddressColumns.City,
		"District":        UserAddressColumns.District,
		"Street":          UserAddressColumns.Street,
		"DetailedAddress": UserAddressColumns.DetailedAddress,
		"PostalCode":      UserAddressColumns.PostalCode,
		"RegionCode":      UserAddressColumns.RegionCode,
		"IsDefault":       UserAddressColumns.IsDefault,
		"Status":          UserAddressColumns.Status,
		"LastUsedAt":      UserAddressColumns.LastUsedAt,
		"CreatedAt":       UserAddressColumns.CreatedAt,
		"UpdatedAt":       UserAddressColumns.UpdatedAt,
		"DeletedAt":       UserAddressColumns.DeletedAt,
		"meta":            UserAddressColumns.Geographic,
	},
	RepositoryNames.UserTaskLog: {
		"Id":        UserTaskLogColumns.ID,
		"UserId":    UserTaskLogColumns.UserID,
		"TaskId":    UserTaskLogColumns.TaskID,
		"TaskName":  UserTaskLogColumns.TaskName,
		"TaskSlug":  UserTaskLogColumns.TaskSlug,
		"Gems":      UserTaskLogColumns.Gems,
		"Growth":    UserTaskLogColumns.Growth,
		"Integrals": UserTaskLogColumns.Integrals,
		"Status":    UserTaskLogColumns.Status,
		"CreatedAt": UserTaskLogColumns.CreatedAt,
		"UpdatedAt": UserTaskLogColumns.UpdatedAt,
	},
	RepositoryNames.UserTransactionLog: {
		"Id":           UserTransactionLogColumns.UserTransactionLogID,
		"UserId":       UserTransactionLogColumns.UserID,
		"UserName":     UserTransactionLogColumns.UserName,
		"AssetType":    UserTransactionLogColumns.AssetType,
		"ChangeType":   UserTransactionLogColumns.ChangeType,
		"ChangeAmount": UserTransactionLogColumns.ChangeAmount,
		"OldAmount":    UserTransactionLogColumns.OldAmount,
		"SourceType":   UserTransactionLogColumns.SourceType,
		"SourceId":     UserTransactionLogColumns.SourceID,
		"Desc":         UserTransactionLogColumns.Desc,
		"Status":       UserTransactionLogColumns.Status,
		"CreatedAt":    UserTransactionLogColumns.CreatedAt,
		"UpdatedAt":    UserTransactionLogColumns.UpdatedAt,
	},
	RepositoryNames.UserIntegralTransactionLog: {
		"Id":          UserIntegralTransactionLogColumns.ID,
		"UserId":      UserIntegralTransactionLogColumns.UserID,
		"UserName":    UserIntegralTransactionLogColumns.UserName,
		"ProductId":   UserIntegralTransactionLogColumns.ProductID,
		"ProductName": UserIntegralTransactionLogColumns.ProductName,
		"ProductCode": UserIntegralTransactionLogColumns.ProductCode,
		"SkuId":       UserIntegralTransactionLogColumns.SkuID,
		"SkuCode":     UserIntegralTransactionLogColumns.SkuCode,
		"Sku":         UserIntegralTransactionLogColumns.Sku,
		"Url":         UserIntegralTransactionLogColumns.URL,
		"OrderId":     UserIntegralTransactionLogColumns.OrderID,
		"OrderSn":     UserIntegralTransactionLogColumns.OrderSN,
		"Point":       UserIntegralTransactionLogColumns.Points,
		"Amount":      UserIntegralTransactionLogColumns.Amount,
		"Status":      UserIntegralTransactionLogColumns.Status,
		"CreatedAt":   UserIntegralTransactionLogColumns.CreatedAt,
		"UpdatedAt":   UserIntegralTransactionLogColumns.UpdatedAt,
	},
	RepositoryNames.UserAttachmentRelationship: {
		"Id":           UserAttachmentRelationshipColumns.AttachmentRelationshipID,
		"UserId":       UserAttachmentRelationshipColumns.UserID,
		"Type":         UserAttachmentRelationshipColumns.Type,
		"AttachmentId": UserAttachmentRelationshipColumns.AttachmentID,
		"Thumbnail":    UserAttachmentRelationshipColumns.AttachmentThumbnail,
		"Order":        UserAttachmentRelationshipColumns.AttachmentOrder,
		"Source":       UserAttachmentRelationshipColumns.AttachmentSource,
		"Url":          UserAttachmentRelationshipColumns.AttachmentImageURL,
		"Alt":          UserAttachmentRelationshipColumns.AttachmentImageAlt,
		"Meta":         UserAttachmentRelationshipColumns.AttachmentImageMeta,
	},
}

var RpcEntityNames = struct { // rpc entities
	User                       string
	Transaction                string
	UserAddress                string
	UserMeta                   string
	UserTaskLog                string
	UserTransactionLog         string
	UserIntegralTransactionLog string
	UserAttachmentRelationship string
}{
	User:                       "user",
	Transaction:                "transaction",
	UserAddress:                "userAddress",
	UserMeta:                   "userMeta",
	UserTaskLog:                "userTaskLog",
	UserTransactionLog:         "userTransactionLog",
	UserIntegralTransactionLog: "userIntegralTransactionLog",
	UserAttachmentRelationship: "userAttachmentRelationship",
}

type ColumnSetting struct {
	Name          string
	RpcEntityName string
}

var RpcEntityPreloadMap = map[string]map[string]*ColumnSetting{
	RpcEntityNames.User: {
		"Address": &ColumnSetting{
			Name:          "Address",
			RpcEntityName: RpcEntityNames.UserAddress,
		},
		"Transaction": &ColumnSetting{
			Name:          "Transaction",
			RpcEntityName: RpcEntityNames.Transaction,
		},
	},
	RpcEntityNames.Transaction: map[string]*ColumnSetting{},
	RpcEntityNames.UserAddress: map[string]*ColumnSetting{},
	RpcEntityNames.UserMeta: {
		"likeCount": &ColumnSetting{
			Name: "_like_count",
		},
		"likeNewStatus": &ColumnSetting{
			Name: "_like_new_status",
		},
		"likeEntryCount": &ColumnSetting{
			Name: "_like_entry_count",
		},
		"likeEntryNewStatus": &ColumnSetting{
			Name: "_like_entry_new_status",
		},
		"collectEntryCount": &ColumnSetting{
			Name: "_collect_entry_count",
		},
		"collectEntryStatus": &ColumnSetting{
			Name: "_collect_entry_status",
		},
		"collectEntryItems": &ColumnSetting{
			Name: "_collect_entry_items",
		},
		"reviewCount": &ColumnSetting{
			Name: "_review_count",
		},
		"reviewPublicCount": &ColumnSetting{
			Name: "_review_public_count",
		},
		"reviewNewStatus": &ColumnSetting{
			Name: "_review_new_status",
		},
		"reviewItems": &ColumnSetting{
			Name: "_review_items",
		},
		"reviewPublicItems": &ColumnSetting{
			Name: "_review_public_items",
		},
		"photoNewStatus": &ColumnSetting{
			Name: "_photo_new_status",
		},
		"photoPostCount": &ColumnSetting{
			Name: "_photo_post_count",
		},
		"postPhotoCount": &ColumnSetting{
			Name: "_post_photo_count",
		},
		"postPhotoPublicCount": &ColumnSetting{
			Name: "_post_photo_public_count",
		},
		"photoPostItems": &ColumnSetting{
			Name: "_photo_post_items",
		},
		"photoPostPublicItems": &ColumnSetting{
			Name: "_photo_post_public_items",
		},
		"askedQuestionCount": &ColumnSetting{
			Name: "_asked_question_count",
		},
		"askedQuestionNewStatus": &ColumnSetting{
			Name: "_asked_question_new_status",
		},
		"askedQuestionItems": &ColumnSetting{
			Name: "_asked_question_items",
		},
		"answeredQuestionCount": &ColumnSetting{
			Name: "_answered_question_count",
		},
		"answeredQuestionNewStatus": &ColumnSetting{
			Name: "_answered_question_new_status",
		},
		"answeredQuestionItems": &ColumnSetting{
			Name: "_answered_question_items",
		},
		"orderCount": &ColumnSetting{
			Name: "_order_count",
		},
		"orderNewStatus": &ColumnSetting{
			Name: "_order_new_status",
		},
		"lastActivity": &ColumnSetting{
			Name: "_last_activity",
		},
		"wantEntryCount": &ColumnSetting{
			Name: "_want_entry_count",
		},
		"ownEntryCount": &ColumnSetting{
			Name: "_own_entry_count",
		},
		"ownEntryItems": &ColumnSetting{
			Name: "_own_entry_items",
		},
		"ownEntryStatus": &ColumnSetting{
			Name: "_own_entry_status",
		},
		"couponCount": &ColumnSetting{
			Name: "_coupon_count",
		},
		"expiringCouponCount": &ColumnSetting{
			Name: "_expiring_coupon_count",
		},
	},
	RpcEntityNames.UserTaskLog:                map[string]*ColumnSetting{},
	RpcEntityNames.UserTransactionLog:         map[string]*ColumnSetting{},
	RpcEntityNames.UserIntegralTransactionLog: map[string]*ColumnSetting{},
	RpcEntityNames.UserAttachmentRelationship: map[string]*ColumnSetting{},
}
